package com.boot.unity.api.modules.training.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.unity.api.modules.training.entity.StageTrainingTime;

@Mapper
public interface StageTrainingTimeDao {

    @Select("select * from training_stage_training_time t where t.id = #{id}")
    StageTrainingTime getById(Long id);

    @Delete("delete from training_stage_training_time where id = #{id}")
    int delete(Long id);

    int update(StageTrainingTime stageTrainingTime);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into training_stage_training_time(inscode, stunum, subject, totaltime, vehicletime, classtime, simulatortime, networktime, duration, examresult, mileage, pdfid, esignature, rectype, recarray, createTime, updateTime) values(#{inscode}, #{stunum}, #{subject}, #{totaltime}, #{vehicletime}, #{classtime}, #{simulatortime}, #{networktime}, #{duration}, #{examresult}, #{mileage}, #{pdfid}, #{esignature}, #{rectype}, #{records}, now(), now())")
    int save(StageTrainingTime stageTrainingTime);
    
    int count(@Param("params") Map<String, Object> params);

    List<StageTrainingTime> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
